home *** CD-ROM | disk | FTP | other *** search
- package sub_arctic.output;
-
-
- import sub_arctic.input.*;
-
- import java.awt.Font;
- import java.awt.Dimension;
- import java.util.Vector;
-
- /**
- * This is an abstract class for generating the styles for a
- * particular look and giving the toolkit information about
- * the feel.
- *
- * @author Ian Smith
- */
-
- public abstract class style {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /* ****************** VERTICAL SCROLLBAR ***************/
- /**
- * Construct three images for a vertical scrollbar. Vertical scrollbars
- * in sub_arctic are assumed to be of fixed width (although this
- * is really not true for motif). All three of these images
- * must be of the same width. Image #0 is the up image,
- * image #1 is the down image and #2 is the background image (which will
- * get tiled along the length of the scrollbar).
- *
- * @return loaded_image[] an array of 3 images for displaying a scrollbar
- * in your style.
- */
- public abstract loaded_image[] v_scrollbar_images();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This method should return how far from the left edge the scrollbar
- * is placed in this style.
- * @return int the "shift" of the v_scrollbar thumb to the right.
- */
- public abstract int v_scrollbar_thumb_shift();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This method should return an image of a thumb of a given
- * height.
- * @param int h the height of the thumb in pixels.
- */
- public abstract loaded_image v_scrollbar_thumb(int h);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This is the minimum height of a scrollbar thumb.
- * @return the minimum usable size of a scrollbar thumb (in pixels).
- */
- public abstract int v_scrollbar_minimum_thumb_size();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /* ****************** HORIZONTAL SCROLLBAR ***************/
- /**
- * Construct three images for a horizontal scrollbar. Horizontal scrollbars
- * in sub_arctic are assumed to be of fixed height (although this
- * is really not true for motif). All three of these images
- * must be of the same height. Image #0 is the left image,
- * image #1 is the right image and #2 is the background image (which will
- * get tiled along the length of the scrollbar).
- *
- * @return loaded_image[] an array of 2 images for displaying a scrollbar in
- * your style.
- */
- public abstract loaded_image[] h_scrollbar_images();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This method should return how far from the top edge the scrollbar
- * is placed in this style.
- * @return int the "shift" of the h_scrollbar thumb down.
- */
- public abstract int h_scrollbar_thumb_shift();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This method should return an image of a thumb of a given
- * width.
- * @param int w the width of the thumb in pixels.
- */
- public abstract loaded_image h_scrollbar_thumb(int w);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This is the minimum width of a scrollbar thumb.
- * @return the minimum usable size of a scrollbar thumb (in pixels).
- */
- public abstract int h_scrollbar_minimum_thumb_size();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /* ****************** BUTTON ***************/
- /**
- * Construct the images for a button. In the returned array,
- * img 0 is the up and img 1 is the depressed (unhappy) appearance.
- *
- * @param String label the string for the button.
- * @param Font the font to draw the button with.
- * @param int x_spacing the amount of x border (appears on left and
- * right).
- * @param int y_spacing the amount of y border (appears on top and
- * bottom).
- * @param boolean menu true if you want the appearance of a menu button.
- * @return loaded_image[] the resulting pair of images.
- */
- public abstract loaded_image[] button_make_images(String label,
- Font font,
- int x_spacing,
- int y_spacing,
- boolean menu);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Construct the images for a button which is blank (so the app
- * can draw on it).
- *
- * @param int width this is the <I>usable</I> width you desire for
- * this button.
- * @param int height this is the <I>usable</I> height you desire for
- * this button.
- * @param int x_spacing the amount of x border (appears on left and
- * right).
- * @param int y_spacing the amount of y border (appears on top and
- * bottom).
- * @param boolean menu true if you want the appearance of a menu button.
- * @return loaded_image[] the resulting pair of images.
- */
- public abstract loaded_image[] button_make_images(int width,
- int height,
- int x_spacing,
- int y_spacing,
- boolean menu);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Return the amount of shift in x required for an image to placed
- * on this style of button. This does NOT including the x spacing
- * but rather only the pixels that the button code isn't normally
- * allowed to use (the beveling).
- *
- * @return int the amount to shift the image on a button in x.
- */
- public abstract int button_x_shift();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Return the amount of shift in y required for an image to placed
- * on this style of button. This does NOT including the y spacing
- * but rather only the pixels that the button code isn't normally
- * allowed to use (the beveling).
- *
- * @return int the amount to shift the image on a button in y.
- */
- public abstract int button_y_shift();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /* ****************** RADIOBUTTON ***************/
- /**
- * Return a pair of images which give the off (img[0]) and the
- * on (img[1]) appearance for a radio button. Note: For some styles,
- * this is the same appearance as a checkbox. These images should
- * be the same size.
- *
- * @return loaded_image[] an array of 2 images for the off and on look of
- * a radio button.
- */
- public abstract loaded_image[] radio_button_make_images();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Return a pair of transitions images for the transitions from
- * (img[0]) off to on and (img[1])on to off. A style may return
- * null here there will be no special transition used.
- *
- * @return loaded_image[] the resulting pair of images.
- */
- public abstract loaded_image[] radio_button_make_transitions();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /* ****************** CHECKBOX ***************/
- /**
- * Return a pair of images which give the off (img[0]) and the
- * on (img[1]) appearance for a checkbox. Note: For some styles,
- * this is the same appearance as a radiobutton. These images should
- * be the same size.
- *
- * @return loaded_image[] an array of 2 images for the off and on look of
- * a checkbox.
- */
- public abstract loaded_image[] checkbox_make_images();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Return a pair of transition images for the transitions from
- * (img[0]) off to on and (img[1])on to off. A style may return
- * null here there will be no special transition used.
- *
- * @return loaded_image[] resulting pair of transition images or null if no
- * special transition effect is needed.
- */
- public abstract loaded_image[] checkbox_make_transitions();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /* ************************ SCALE ***********************/
- /**
- * This function returns the image of a scale's background
- * at a given width in pixels.
- *
- * @param int w the width of the scale in pixels.
- * @return loaded_image the image of the scale's background.
- */
- public abstract loaded_image scale_background(int w);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This returns the height of the scale in pixels. We assume
- * that scales are not resizable in height.
- * @return int the height of the scale.
- */
- public abstract int scale_height();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This returns the image of the thumb of a scale.
- * @return loaded_image the image of the thumb.
- */
- public abstract loaded_image scale_thumb();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This returns the number of pixels the thumb is shifted
- * down from the top of the scale.
- * @return int the amount of the shift of the thumb in y.
- */
- public abstract int scale_thumb_shift();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This returns the amount of space on both ends which
- * is used by the system for its beveling/color scheme.
- * If you are using a 1 pixel bevel return 1 here.
- *
- * @return int the number of pixels to shift the display of the thumb to
- * the right.
- */
- public abstract int scale_unusable_width();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /* ********************** MISC *************************/
- /**
- * This function gets called to inform the style that the
- * default_color_scheme has changed. This is to allow the
- * style to do any necessary recalculation of images based
- * on the new color_scheme before interactors become notified
- * that there is a new color_scheme.
- */
- public abstract void color_scheme_changed();
-
- /* ************************ MENU ***********************/
- /**
- * This function determines if a menu pops to the right and
- * down from an menu button interactor or if it pops directly
- * down. Return true for the (mac style) pop to the right
- * type and false for the (motif style) pop string down type.
- * @return boolean true for pop-right false for pop-down.
- */
- public abstract boolean menu_pop_right();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This function determines the "natural" size of menu item
- * of text. Menu items can be made any width, but this expresses
- * the natural size of the object. The style object may include
- * extra space for interactors that are placed on the menu
- * item.
- *
- * @param String s the string to display
- * @param Font f the font to display the text in
- * @param int x_spacing the amount of horizontal spacing desired (this
- * is 1/2 the total horizontal spacing).
- * @param int y_spacing the amount of vertical spacing desired (this
- * is 1/2 the total vertical spacing).
- * @return Dimension the natural size of this menu item.
- */
- public abstract Dimension menu_item_natural_size(String s, Font f,
- int x_spacing,
- int y_spacing);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This function creates the two images of a menu up (unhighlighted)
- * & down (highlighted). You must supply the width and height of
- * the images you wish to create; use menu_item_natural_size()
- * to determine the natural size of menu items. The style
- * object is expected to observe the x_spacing and y_spacing
- * arguments, even if this forces clipping or overdrawing
- * to occur.
- *
- * @param String s the string to display.
- * @param Font f the font to display the text in.
- * @param int x_spacing the amount of horizontal spacing desired.
- * @param int y_spacing the amount of vertical spacing desired.
- * @param int w width of the image.
- * @param int h height of the image.
- * @param boolean pullright true if you want a notation for a pullright
- * image on this menu item.
- */
- public abstract loaded_image[] menu_item_image(String s, Font f,
- int x_spacing, int y_spacing,
- int w, int h,
- boolean pullright);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Return the image of a menu separator. The style may choose
- * to return a zero height object for this separator if it does
- * not allow menu separators.
- *
- * @return loaded_image the image of the separator.
- */
- public abstract loaded_image menu_item_separator(int w);
-
-
- /* ************************ DRAWABLE ***********************/
- /**
- * This function gets called to force the style to set up
- * a rectangular area of a drawable. The caller is requesting
- * that the drawable be prepared for further drawing by caller.
- * This is useful interactors which do their drawing in
- * draw_self_local() and/or people wishing to implement new
- * interactors which can "fit in" with the style.
- *
- * @param drawable d the drawable to prepare.
- * @param int x the x coordinate of the top left corner of the area to
- * prepare.
- * @param int y the y coordinate of the top left corner of the area to
- * prepare.
- * @param int w the width of the area to prepare.
- * @param int h the height of the area of prepare.
- * @param boolean up if this is true the style may draw this area raised,
- * if this is false the style may draw this area lowered.
- * The style is under no obligation to follow this hint.
- * @param boolean fill true if the style system should fill the background
- */
- public abstract void drawable_prepare_rect(drawable d, int x, int y,
- int w, int h, boolean up,
- boolean fill);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This function is called to allow the caller to determine what area
- * of the drawable has been prepared by the style.
- * @return int the amount of horizontal space used by the style (XXX
- * assumes left/right symmetry)
- */
- public abstract int drawable_horizontal_space();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This function is called to allow the caller to determine what area
- * of the drawable has been prepared by the style.
- * @return int the amount of vertical space used by the style (XXX assumes
- * up/down symmetry)
- */
- public abstract int drawable_vertical_space();
-
- /* ************************ MENUBAR ***********************/
- /**
- * This is the most complex of the style functions, and the one that
- * certainly leaves the most room for improvement. The caller of
- * this function is requesting several things. First, an image to
- * display for a menu bar of a given width. Second, a set of
- * rectangles that tell the menubar infrastructure what regions of
- * the menu bar are "hot." Finally, the caller is asking for
- * a set of images that corresponds to the "depressed" images
- * of each hotspt. <P>
-
- * The caller supplies the style system with two vectors. Each
- * vector must contain <I>only</I> strings or loaded_images. (If
- * the loaded images are taller than the height of the font supplied,
- * they will be clipped.) The caller is responsible for making
- * sure the types of the objects are correct. The style system will
- * create it set of hot spots and images with the first vector
- * occupying the "normal" or left positions and the the second
- * vector occupying the "special" or right positions. These vectors
- * may not be null, although they may be empty.
- *
- * @param Vector left_items this should be a non-null (but possibly
- * empty) vector of strings and images. Items
- * in this vector will be replaced with
- * loaded_images representing that items "down"
- * image. These items will appear on the left
- * of the menu bar, in the order supplied.
- * @param Vector right_items this should be a non-null (but possibly
- * empty) vector of strings and images. Items
- * in this vector will be replaced with
- * loaded_images representing that items "down"
- * image. These items will appear on the right
- * of the menubar in the order supplied (last
- * in the Vector being the rightmost).
- * @param int width width of the menubar in pixels (items which
- * don't fit on the menubar will be clipped).
- * @param Font font the font to use for rendering strings. If
- * you have a menubar which has only images on
- * it, the menu bar is still the height of this
- * font.
- * @param Vector left_hotspots the caller should pass a non-null but empty
- * vector which will be filled in which
- * Rectangle objects indicating the positions
- * of the objects in the left vector on the
- * returned image.
- * @param Vector right_hotspots the caller should pass a non-null but empty
- * vector which will be filled in which
- * Rectangle objects indicating the positions
- * of the objects in the right vector on the
- * returned image.
- * @return loaded_image the image of the menu bar at the selected width.
- */
- public abstract loaded_image make_menubar_images(Vector left,
- Vector right,
- int width,
- Font font,
- Vector left_hotspots,
- Vector right_hotspots);
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This parameter controls how far down the images resulting from
- * a menubar should be shifted down (in their hotspot) to compensate
- * for potential style system beveling.
- *
- * @return int the number of pixels the depressed images should be shifted
- * down in their hotspot when the button is depressed.
- */
- public abstract int menubar_image_shift();
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- }
-
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-